<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>RTOS - a cooperative multitasking library: pRTOS.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">RTOS - a cooperative multitasking library
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">pRTOS.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">//**************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment">//</span>
<a name="l00003"></a>00003 <span class="comment">// This file contains its own documentation in Doxygen format.</span>
<a name="l00004"></a>00004 <span class="comment">// After running doxygen: open the rtf file; select all; r-click-&gt;update.</span>
<a name="l00005"></a>00005 <span class="comment">//</span>
<a name="l00020"></a>00020 <span class="comment"></span>
<a name="l00064"></a>00064 <span class="comment">//</span>
<a name="l00065"></a>00065 <span class="comment">//***************************************************************************</span>
<a name="l00066"></a>00066 
<a name="l00067"></a>00067 <span class="preprocessor">#ifndef __RTOS</span>
<a name="l00068"></a>00068 <span class="preprocessor"></span><span class="preprocessor">#define __RTOS</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00070"></a>00070 <span class="preprocessor">#define RTOS_VERSION &quot;V3.02 (2011-05-24)&quot;</span>
<a name="l00071"></a>00071 <span class="preprocessor"></span>
<a name="l00072"></a>00072 <span class="comment">// we need NULL</span>
<a name="l00073"></a>00073 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 <span class="comment">//***************************************************************************</span>
<a name="l00076"></a>00076 <span class="comment">//</span>
<a name="l00107"></a>00107 <span class="comment"></span><span class="comment">//</span>
<a name="l00108"></a>00108 <span class="comment">//***************************************************************************</span>
<a name="l00109"></a>00109 
<a name="l00110"></a>00110 <span class="preprocessor">#define global_logging 1</span>
<a name="l00111"></a>00111 <span class="preprocessor"></span>
<a name="l00112"></a>00112 <span class="preprocessor">#define RTOS_STATISTICS_ENABLED 1</span>
<a name="l00113"></a>00113 <span class="preprocessor"></span>
<a name="l00114"></a>00114 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> RTOS_DEFAULT_STACK_SIZE = 2048;
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> RTOS_MAX_PRIORITY = 10000;
<a name="l00117"></a>00117 
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="comment">//***************************************************************************</span>
<a name="l00120"></a>00120 <span class="comment">//</span>
<a name="l00155"></a>00155 <span class="comment"></span><span class="comment">//</span>
<a name="l00156"></a>00156 <span class="comment">//***************************************************************************</span>
<a name="l00157"></a>00157 
<a name="l00158"></a>00158    <span class="comment">// The macro HERE transates to a newline, the file-name, &quot;:&quot;, and</span>
<a name="l00159"></a>00159    <span class="comment">// the line-number of the place where the HERE macro appears.</span>
<a name="l00160"></a>00160    <span class="comment">// This can be used for debug logging. used by the trace macro.</span>
<a name="l00161"></a>00161 <span class="preprocessor">#define HERE_STR( X ) #X</span>
<a name="l00162"></a>00162 <span class="preprocessor"></span><span class="preprocessor">#define HERE2( F, L ) ( &quot;\n&quot; F &quot;:&quot; HERE_STR( L ))</span>
<a name="l00163"></a>00163 <span class="preprocessor"></span><span class="preprocessor">#define HERE HERE2( __FILE__, __LINE__ )</span>
<a name="l00164"></a>00164 <span class="preprocessor"></span>
<a name="l00165"></a>00165    <span class="comment">// Printing to trace (instead of cout) prepends HERE and a space,</span>
<a name="l00166"></a>00166    <span class="comment">// or trace can be used standalone like &#39;trace;&#39;</span>
<a name="l00167"></a>00167 <span class="preprocessor">#define trace ( std::cout &lt;&lt; HERE &lt;&lt; &quot; &quot; )</span>
<a name="l00168"></a>00168 <span class="preprocessor"></span>
<a name="l00169"></a>00169    <span class="comment">// allocate memory for the string and copy the content</span>
<a name="l00170"></a>00170 <span class="keyword">const</span> <span class="keywordtype">char</span> * string_allocate( <span class="keyword">const</span> <span class="keywordtype">char</span> *name );
<a name="l00171"></a>00171 
<a name="l00172"></a>00172 <span class="comment">// the macro RTOS_STATISTICS is used to prefix a single line</span>
<a name="l00173"></a>00173 <span class="comment">// that will be commented out when statistics is disabled</span>
<a name="l00174"></a>00174 <span class="preprocessor">#if RTOS_STATISTICS_ENABLED</span>
<a name="l00175"></a>00175 <span class="preprocessor"></span><span class="preprocessor">   #define RTOS_STATISTICS( x ) x</span>
<a name="l00176"></a>00176 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00177"></a>00177 <span class="preprocessor"></span><span class="preprocessor">   #define RTOS_STATISTICS( x )</span>
<a name="l00178"></a>00178 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00179"></a>00179 <span class="preprocessor"></span>
<a name="l00180"></a>00180 <span class="keyword">const</span> <span class="keywordtype">char</span> * string_allocate( <span class="keyword">const</span> <span class="keywordtype">char</span> *name );
<a name="l00181"></a>00181 
<a name="l00182"></a>00182 
<a name="l00183"></a>00183 <span class="comment">//***************************************************************************</span>
<a name="l00184"></a>00184 <span class="comment">//</span>
<a name="l00197"></a>00197 <span class="comment"></span><span class="comment">//</span>
<a name="l00198"></a>00198 <span class="comment">//***************************************************************************</span>
<a name="l00199"></a>00199 
<a name="l00200"></a>00200 <span class="preprocessor">#define  S * ( 1000 * 1000 )</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span><span class="preprocessor">#define MS * 1000</span>
<a name="l00202"></a>00202 <span class="preprocessor"></span><span class="preprocessor">#define US * 1</span>
<a name="l00203"></a>00203 <span class="preprocessor"></span>
<a name="l00204"></a>00204 
<a name="l00205"></a>00205 <span class="comment">//***************************************************************************</span>
<a name="l00206"></a>00206 <span class="comment">//</span>
<a name="l00240"></a>00240 <span class="comment"></span><span class="comment">//</span>
<a name="l00241"></a>00241 <span class="comment">//***************************************************************************</span>
<a name="l00242"></a>00242 
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 <span class="comment">//***************************************************************************</span>
<a name="l00245"></a>00245 <span class="comment">//</span>
<a name="l00280"></a>00280 <span class="comment"></span><span class="comment">//</span>
<a name="l00281"></a>00281 <span class="comment">//***************************************************************************</span>
<a name="l00282"></a>00282 
<a name="l00283"></a>00283 
<a name="l00284"></a>00284 <span class="comment">//***************************************************************************</span>
<a name="l00285"></a>00285 <span class="comment">//</span>
<a name="l00286"></a>00286 <span class="comment">// class RTOS</span>
<a name="l00287"></a>00287 <span class="comment">//</span>
<a name="l00289"></a>00289 <span class="comment"></span><span class="comment">//</span>
<a name="l00293"></a>00293 <span class="comment"></span><span class="comment">//</span>
<a name="l00294"></a>00294 <span class="comment">//***************************************************************************</span>
<a name="l00295"></a>00295 
<a name="l00296"></a><a class="code" href="class_r_t_o_s.html">00296</a> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a> {
<a name="l00297"></a>00297 <span class="keyword">public</span>:
<a name="l00298"></a>00298    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">task</a>;
<a name="l00299"></a>00299    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a>;
<a name="l00300"></a>00300    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a>;
<a name="l00301"></a>00301    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a>;
<a name="l00302"></a>00302    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a>;
<a name="l00303"></a>00303    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">clock</a>;
<a name="l00304"></a>00304    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">mutex</a>;
<a name="l00305"></a>00305    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mailbox.html" title="synchronous handling over of a data item">mailbox</a>;
<a name="l00306"></a>00306    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T, const <span class="keywordtype">int</span> SIZE&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1channel.html" title="waitable data queue">channel</a>;
<a name="l00307"></a>00307    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1pool.html" title="place to store and rectrieve data, no built-in synchronisation">pool</a>;
<a name="l00308"></a>00308    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a>;
<a name="l00309"></a>00309    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a>;
<a name="l00310"></a>00310    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a>;
<a name="l00311"></a>00311 
<a name="l00312"></a>00312 <span class="keyword">private</span>:
<a name="l00313"></a>00313    <span class="keyword">class </span>waitable_set;
<a name="l00314"></a>00314    <span class="keyword">class </span>callback;
<a name="l00315"></a>00315 
<a name="l00317"></a>00317    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">task</a> * rtos_current_task;
<a name="l00318"></a>00318 
<a name="l00320"></a>00320    <span class="keyword">static</span> <span class="keywordtype">bool</span> must_clear;
<a name="l00321"></a>00321    
<a name="l00323"></a>00323    <span class="keyword">static</span> <span class="keywordtype">void</span> do_statistics_clear (<span class="keywordtype">void</span>);
<a name="l00324"></a>00324 
<a name="l00326"></a>00326    <a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>( <span class="keywordtype">void</span> ){}
<a name="l00327"></a>00327 
<a name="l00329"></a>00329    <span class="keyword">static</span> callback * timerList;
<a name="l00330"></a>00330    
<a name="l00332"></a>00332    <span class="keyword">static</span> <span class="keywordtype">void</span> add( callback * t );
<a name="l00333"></a>00333 
<a name="l00335"></a>00335    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">task</a> * taskList;
<a name="l00336"></a>00336    
<a name="l00338"></a>00338    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">task</a> * <a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">task</a> );
<a name="l00339"></a>00339 
<a name="l00341"></a>00341    <span class="keyword">static</span> <span class="keywordtype">bool</span> scheduler_running;
<a name="l00342"></a>00342 
<a name="l00344"></a>00344    <span class="keyword">static</span> <span class="keywordtype">void</span> beat (<span class="keywordtype">void</span>);
<a name="l00345"></a>00345 
<a name="l00347"></a>00347    <span class="keyword">friend</span> <span class="keywordtype">void</span>  <a class="code" href="class_r_t_o_s.html#a652c85c18e3a82a8fdd9ccd5bc1abd47" title="the timer interrupt, updates runTime and ElapsedTime">timerISR</a> (<span class="keywordtype">void</span>);
<a name="l00348"></a>00348 
<a name="l00349"></a>00349 <span class="preprocessor">#if RTOS_STATISTICS_ENABLED</span>
<a name="l00350"></a>00350 <span class="preprocessor"></span>   <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a> *flags;
<a name="l00351"></a>00351    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a> *timers;
<a name="l00352"></a>00352    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">clock</a> *clocks;
<a name="l00353"></a>00353    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">mutex</a> *mutexes;
<a name="l00354"></a>00354    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a> *channels;
<a name="l00355"></a>00355    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a> *mailboxes;
<a name="l00356"></a>00356    <span class="keyword">static</span> <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a> *pools;
<a name="l00357"></a>00357 
<a name="l00358"></a>00358    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a> * f );
<a name="l00359"></a>00359    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a> * t );
<a name="l00360"></a>00360    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">clock</a> * c );
<a name="l00361"></a>00361    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">mutex</a> * m );
<a name="l00362"></a>00362    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a> * c );
<a name="l00363"></a>00363    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a> * m );
<a name="l00364"></a>00364    <span class="keyword">static</span> <span class="keywordtype">void</span> add( <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a> *p );
<a name="l00365"></a>00365 <span class="preprocessor">#endif</span>
<a name="l00366"></a>00366 <span class="preprocessor"></span>
<a name="l00367"></a>00367 <span class="keyword">public</span>:
<a name="l00368"></a>00368 
<a name="l00370"></a>00370    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s.html#a354317abf0afae8b4d228eb63e76e71b" title="runs the scheduler">run</a>( <span class="keywordtype">void</span> );
<a name="l00371"></a>00371 
<a name="l00373"></a><a class="code" href="class_r_t_o_s.html#a7e455e2e010e6af8f9f41cbeacfe6bd0">00373</a>    <span class="keyword">static</span> task * <a class="code" href="class_r_t_o_s.html#a7e455e2e010e6af8f9f41cbeacfe6bd0" title="returns (a pointer to) the currently executing task">current_task</a>( <span class="keywordtype">void</span> ){ <span class="keywordflow">return</span> rtos_current_task; }
<a name="l00374"></a>00374 
<a name="l00376"></a>00376    <span class="keyword">static</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s.html#adc4aa432c2d87f5a62f13584458f899c" title="get elapsed time in micro seconds since OS startup">run_time</a>( <span class="keywordtype">void</span> );
<a name="l00377"></a>00377 
<a name="l00379"></a>00379    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s.html#a7616a0f527019fe03f5ffbe590e3fae6" title="prints statistics about the tasks to the stream.">print</a>( std::ostream &amp; stream );
<a name="l00380"></a>00380 
<a name="l00382"></a>00382       <span class="comment">//</span>
<a name="l00385"></a><a class="code" href="class_r_t_o_s.html#aa9b2602178a340b2ad59ca82d4b09b5e">00385</a> <span class="comment"></span>   <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s.html#aa9b2602178a340b2ad59ca82d4b09b5e" title="clears the statistics.">statistics_clear</a>( <span class="keywordtype">void</span> ){ must_clear = <span class="keyword">true</span>; }
<a name="l00386"></a>00386 
<a name="l00388"></a>00388    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s.html#a5a445fcf261e2be2d7b09036001cc814" title="print the statistics">display_statistics</a>( <span class="keywordtype">void</span> );
<a name="l00389"></a>00389 
<a name="l00390"></a>00390    <span class="comment">//************************************************************************</span>
<a name="l00391"></a>00391    <span class="comment">//</span>
<a name="l00392"></a>00392    <span class="comment">// class event</span>
<a name="l00393"></a>00393    <span class="comment">//</span>
<a name="l00395"></a>00395 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00408"></a>00408 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00409"></a>00409    <span class="comment">//************************************************************************</span>
<a name="l00410"></a>00410 <span class="keyword">public</span>:
<a name="l00411"></a><a class="code" href="class_r_t_o_s_1_1event.html">00411</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> {
<a name="l00412"></a>00412    <span class="keyword">public</span>:
<a name="l00413"></a>00413       
<a name="l00415"></a>00415         <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1event.html#af3a6450c08560383db9f34b3d826d126" title="prints an event, for debugging only">print</a>( std::ostream &amp; s ) <span class="keyword">const</span>;
<a name="l00416"></a>00416            
<a name="l00418"></a>00418       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1event.html#ad8d6bd84ac8374c4ab9f9eb8579face0" title="report wether two events are the same">operator==</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> &amp; rhs ) <span class="keyword">const</span>;
<a name="l00419"></a>00419       
<a name="l00421"></a>00421       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1event.html#ad8d6bd84ac8374c4ab9f9eb8579face0" title="report wether two events are the same">operator==</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a> &amp; rhs ) <span class="keyword">const</span>;
<a name="l00422"></a>00422       
<a name="l00424"></a>00424       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1event.html#a7d5e26e1dcd4f4d43cc569188ae4ed12" title="report wether two events are not the same">operator!=</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> &amp; rhs ) <span class="keyword">const</span>;
<a name="l00425"></a>00425       
<a name="l00427"></a>00427       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1event.html#a7d5e26e1dcd4f4d43cc569188ae4ed12" title="report wether two events are not the same">operator!=</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a> &amp; rhs ) <span class="keyword">const</span>;
<a name="l00428"></a>00428       
<a name="l00430"></a>00430       <span class="comment">//</span>
<a name="l00433"></a>00433 <span class="comment"></span>      <span class="keyword">event</span> <a class="code" href="class_r_t_o_s_1_1event.html#a55a1c8d9e8511156c8f87e223e29d92b" title="add two waitables, result can be used in a wait() call">operator+</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> &amp; rhs ) <span class="keyword">const</span>;
<a name="l00434"></a>00434 
<a name="l00435"></a>00435    <span class="keyword">protected</span>:
<a name="l00436"></a>00436       
<a name="l00438"></a><a class="code" href="class_r_t_o_s_1_1event.html#a1402687edb26c1d5d26e54dbda21919d">00438</a>       task * <a class="code" href="class_r_t_o_s_1_1event.html#a1402687edb26c1d5d26e54dbda21919d" title="the owner task">t</a>;
<a name="l00439"></a>00439       
<a name="l00441"></a>00441       <span class="comment">//</span>
<a name="l00444"></a><a class="code" href="class_r_t_o_s_1_1event.html#a74f6161d8c82d461ae3ba29f0e222b59">00444</a> <span class="comment"></span>      <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1event.html#a74f6161d8c82d461ae3ba29f0e222b59" title="the mask of this event, one bit is set">mask</a>;
<a name="l00445"></a>00445       
<a name="l00447"></a><a class="code" href="class_r_t_o_s_1_1event.html#a00cf9d5d01e670e2b358c2a4c7578e7d">00447</a>       <a class="code" href="class_r_t_o_s_1_1event.html#a00cf9d5d01e670e2b358c2a4c7578e7d" title="constructor, used by concrete events">event</a>( task * t, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1event.html#a74f6161d8c82d461ae3ba29f0e222b59" title="the mask of this event, one bit is set">mask</a> ): t( t ), mask( mask ){}
<a name="l00448"></a>00448 
<a name="l00449"></a>00449       <span class="keyword">friend</span> <span class="keyword">class </span>waitable_set;
<a name="l00450"></a>00450    };
<a name="l00451"></a>00451 
<a name="l00452"></a>00452 
<a name="l00453"></a>00453    <span class="comment">//************************************************************************</span>
<a name="l00454"></a>00454    <span class="comment">//</span>
<a name="l00455"></a>00455    <span class="comment">// class waitable</span>
<a name="l00456"></a>00456    <span class="comment">//</span>
<a name="l00458"></a>00458 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00486"></a>00486 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00487"></a>00487    <span class="comment">//************************************************************************</span>
<a name="l00488"></a>00488 <span class="keyword">public</span>:
<a name="l00489"></a><a class="code" href="class_r_t_o_s_1_1waitable.html">00489</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> {
<a name="l00490"></a>00490    <span class="keyword">public</span>:
<a name="l00491"></a>00491 
<a name="l00493"></a>00493       <span class="comment">//</span>
<a name="l00496"></a><a class="code" href="class_r_t_o_s_1_1waitable.html#a44ac71980592721bc03e076acc7e8c67">00496</a> <span class="comment"></span>      <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1waitable.html#a44ac71980592721bc03e076acc7e8c67" title="clear the waitable">clear</a>( <span class="keywordtype">void</span> ){ t-&gt;waitables.<a class="code" href="class_r_t_o_s_1_1waitable.html#a44ac71980592721bc03e076acc7e8c67" title="clear the waitable">clear</a>( *<span class="keyword">this</span> ); }
<a name="l00497"></a>00497 
<a name="l00498"></a>00498    <span class="keyword">protected</span>:
<a name="l00499"></a>00499       
<a name="l00501"></a>00501         <span class="comment">//</span>
<a name="l00503"></a>00503 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1waitable.html#a5a5bf9012a332a6451ee10728153908a" title="constructor, specify owner and name">waitable</a>( task * task , <span class="keyword">const</span> <span class="keywordtype">char</span> *name );
<a name="l00504"></a>00504       
<a name="l00506"></a><a class="code" href="class_r_t_o_s_1_1waitable.html#a3a72bdf94092471e82ba2d04cdc4a58e">00506</a>       <span class="keywordtype">void</span> <span class="keyword">set</span> ( void ){ t-&gt;waitables.<a class="code" href="class_r_t_o_s_1_1timer.html#ae3507bb8a4384466d4b1a48098ae038f" title="set the timer to timeout after the specified time">set</a>( *<span class="keyword">this</span> ); }
<a name="l00507"></a>00507 
<a name="l00508"></a>00508       RTOS_STATISTICS( <span class="keyword">const</span> <span class="keywordtype">char</span> *waitable_name; )
<a name="l00509"></a>00509 
<a name="l00510"></a>00510       <span class="keyword">friend</span> <span class="keyword">class</span> waitable_set;
<a name="l00511"></a>00511    };
<a name="l00512"></a>00512 
<a name="l00513"></a>00513 
<a name="l00514"></a>00514    <span class="comment">//************************************************************************</span>
<a name="l00515"></a>00515    <span class="comment">//</span>
<a name="l00516"></a>00516    <span class="comment">// class flag</span>
<a name="l00517"></a>00517    <span class="comment">//</span>
<a name="l00519"></a>00519 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00548"></a>00548 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00549"></a>00549    <span class="comment">//************************************************************************</span>
<a name="l00550"></a>00550 
<a name="l00551"></a>00551 <span class="keyword">public</span>:
<a name="l00552"></a><a class="code" href="class_r_t_o_s_1_1flag.html">00552</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a> {
<a name="l00553"></a>00553    <span class="keyword">public</span>:
<a name="l00554"></a>00554       
<a name="l00556"></a>00556         <span class="comment">//</span>
<a name="l00559"></a>00559 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1flag.html#a2d05d296b33e6cbc141fd4fb5e6f2740" title="constructor, specify onwer and name">flag</a>( task * t, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> );
<a name="l00560"></a>00560       
<a name="l00562"></a>00562       <span class="comment">//</span>
<a name="l00565"></a>00565 <span class="comment"></span>      <span class="keywordtype">void</span> <span class="keyword">set</span> ( void );
<a name="l00566"></a>00566       
<a name="l00568"></a>00568       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1flag.html#a38ac8e72fcd0b7bcc45fd00acb156cbb" title="prints flag infomation (for debugging)">print</a>( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l00569"></a>00569 
<a name="l00570"></a>00570    <span class="keyword">private</span>:
<a name="l00571"></a>00571       
<a name="l00572"></a>00572         <span class="comment">// this information is needed for statistics only</span>
<a name="l00573"></a>00573       RTOS_STATISTICS( <a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a> *next_flag; )
<a name="l00574"></a>00574       RTOS_STATISTICS( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n_sets; )
<a name="l00575"></a>00575       RTOS_STATISTICS( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n_gets; )
<a name="l00576"></a>00576       
<a name="l00577"></a>00577       <span class="keyword">friend</span> <span class="keyword">class</span> <a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l00578"></a>00578    };
<a name="l00579"></a>00579 
<a name="l00580"></a>00580 
<a name="l00581"></a>00581    <span class="comment">//************************************************************************</span>
<a name="l00582"></a>00582    <span class="comment">//</span>
<a name="l00583"></a>00583    <span class="comment">// class waitable_set</span>
<a name="l00584"></a>00584    <span class="comment">//</span>
<a name="l00586"></a>00586 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00587"></a>00587    <span class="comment">//************************************************************************</span>
<a name="l00588"></a>00588 
<a name="l00589"></a>00589 <span class="keyword">private</span>:
<a name="l00590"></a>00590    <span class="keyword">class </span>waitable_set {
<a name="l00591"></a>00591    <span class="keyword">private</span>:
<a name="l00592"></a>00592       <span class="keyword">event</span> wait( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> mask );
<a name="l00593"></a>00593 
<a name="l00594"></a>00594    <span class="keyword">public</span>:
<a name="l00595"></a>00595       task * client;
<a name="l00596"></a>00596       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> current_waitables;
<a name="l00597"></a>00597       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> requested_waitables;
<a name="l00598"></a>00598       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> used;
<a name="l00599"></a>00599 
<a name="l00600"></a>00600       waitable_set( task * client ):
<a name="l00601"></a>00601          client( client ),
<a name="l00602"></a>00602          current_waitables( 0 ),
<a name="l00603"></a>00603          requested_waitables( 0 ),
<a name="l00604"></a>00604          used( 0 ) {}
<a name="l00605"></a>00605 
<a name="l00606"></a>00606       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> waitable_allocate( <span class="keywordtype">void</span> );
<a name="l00607"></a>00607       <span class="keywordtype">void</span> <span class="keyword">set</span>( <span class="keyword">const</span> waitable &amp;w );
<a name="l00608"></a>00608       <span class="keywordtype">void</span> clear( <span class="keyword">const</span> waitable &amp;w );
<a name="l00609"></a>00609 
<a name="l00610"></a>00610       <span class="keyword">event</span> wait( <span class="keywordtype">void</span> ){ <span class="keywordflow">return</span> wait( ~0 ); }
<a name="l00611"></a>00611       <span class="keyword">event</span> wait( <span class="keyword">const</span> waitable &amp; w ){ <span class="keywordflow">return</span> wait( w.mask ); }
<a name="l00612"></a>00612       <span class="keyword">event</span> wait( <span class="keyword">const</span> event &amp; <span class="keyword">set</span> ){ <span class="keywordflow">return</span> wait( <span class="keyword">set</span>.mask ); }
<a name="l00613"></a>00613    };
<a name="l00614"></a>00614 
<a name="l00615"></a>00615 
<a name="l00616"></a>00616    <span class="comment">//************************************************************************</span>
<a name="l00617"></a>00617    <span class="comment">//</span>
<a name="l00618"></a>00618    <span class="comment">// class RTOS::task</span>
<a name="l00619"></a>00619    <span class="comment">//</span>
<a name="l00621"></a>00621 <span class="comment"></span>   <span class="comment">//</span>
<a name="l00781"></a>00781 <span class="comment"></span>
<a name="l00782"></a>00782 
<a name="l00783"></a>00783    
<a name="l00784"></a>00784    <span class="comment">// A task is created by inheriting</span>
<a name="l00785"></a>00785    <span class="comment">// from task and providing a main() function. Initialisation of the task,</span>
<a name="l00786"></a>00786    <span class="comment">// including creating its waitables, should be done in the constructor.</span>
<a name="l00787"></a>00787    <span class="comment">// Don&#39;t forget to call the constructor of the task class!</span>
<a name="l00788"></a>00788    <span class="comment">//</span>
<a name="l00789"></a>00789    <span class="comment">// The main() is the body of the task. It should never terminate.</span>
<a name="l00790"></a>00790    <span class="comment">//</span>
<a name="l00791"></a>00791    <span class="comment">// Each task has a unique priority (an unsigned integer).</span>
<a name="l00792"></a>00792    <span class="comment">// A lower value indicates a higher priority.</span>
<a name="l00793"></a>00793    <span class="comment">// The RTOS scheduler will always run the task with the higest-priority</span>
<a name="l00794"></a>00794    <span class="comment">// runnable (neither blocked nor suspended) task.</span>
<a name="l00795"></a>00795    <span class="comment">// A task runs until it changes this &#39;situation&#39; by using an RTOS</span>
<a name="l00796"></a>00796    <span class="comment">// call that changes its own state to not runnable, or the state of a</span>
<a name="l00797"></a>00797    <span class="comment">// higher priority task to runnable.</span>
<a name="l00798"></a>00798    <span class="comment">//</span>
<a name="l00799"></a>00799    <span class="comment">// Timers are served only when the RTOS is activated</span>
<a name="l00800"></a>00800    <span class="comment">// by calling any of its state-changing interfaces.</span>
<a name="l00801"></a>00801    <span class="comment">// Hence the longest run time between such calls determines the granularity</span>
<a name="l00802"></a>00802    <span class="comment">// (timewise responsiveness) of the application.</span>
<a name="l00803"></a>00803    <span class="comment">// Within a timeconsuming computation a task can call release() to have</span>
<a name="l00804"></a>00804    <span class="comment">// the RTOS serve the timers.   </span>
<a name="l00805"></a>00805    <span class="comment">//</span>
<a name="l00806"></a>00806    <span class="comment">//************************************************************************</span>
<a name="l00807"></a>00807 
<a name="l00808"></a>00808 <span class="keyword">public</span>:
<a name="l00809"></a><a class="code" href="class_r_t_o_s_1_1task.html">00809</a>    <span class="keyword">class </span>task {
<a name="l00810"></a>00810 
<a name="l00811"></a>00811    <span class="keyword">private</span>:
<a name="l00812"></a>00812 
<a name="l00813"></a>00813          <span class="comment">// The RTOS uses block() and unblock() to implement the</span>
<a name="l00814"></a>00814          <span class="comment">// synhronisation mechanisms (waitables).</span>
<a name="l00815"></a>00815       <span class="keywordtype">bool</span> task_is_blocked;
<a name="l00816"></a>00816 
<a name="l00817"></a>00817          <span class="comment">// A task can be suspended and resumed by the application,</span>
<a name="l00818"></a>00818          <span class="comment">// using the suspend() and resume() calls.</span>
<a name="l00819"></a>00819          <span class="comment">// The RTOS itself never suspends or resumes a task.</span>
<a name="l00820"></a>00820       <span class="keywordtype">bool</span> task_is_suspended;
<a name="l00821"></a>00821 
<a name="l00822"></a>00822          <span class="comment">// task name, only for statistics</span>
<a name="l00823"></a>00823       RTOS_STATISTICS( <span class="keyword">const</span> <span class="keywordtype">char</span> *task_name; )
<a name="l00824"></a>00824 
<a name="l00825"></a>00825          <span class="comment">// a lower number means a higher priority, 0 is highest</span>
<a name="l00826"></a>00826       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> task_priority;
<a name="l00827"></a>00827 
<a name="l00828"></a>00828          <span class="comment">// timer for sleep() call</span>
<a name="l00829"></a>00829       <a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a> * sleep_timer;
<a name="l00830"></a>00830 
<a name="l00831"></a>00831    <span class="keyword">protected</span>:
<a name="l00832"></a>00832 
<a name="l00834"></a>00834       <span class="comment">//</span>
<a name="l00857"></a>00857 <span class="comment"></span>   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#addc6d52f8792ddba1158d7ae5ef0037d" title="task body, must be provided by a derived class">main</a>( <span class="keywordtype">void</span> ) = 0;
<a name="l00858"></a>00858       
<a name="l00859"></a>00859    <span class="keyword">private</span>:   
<a name="l00860"></a>00860 
<a name="l00861"></a>00861       <span class="comment">// must call main()</span>
<a name="l00862"></a>00862       <span class="keyword">friend</span> <span class="keywordtype">void</span> task_trampoline( <span class="keywordtype">void</span> );
<a name="l00863"></a>00863 
<a name="l00864"></a>00864    <span class="keyword">public</span>:
<a name="l00865"></a>00865 
<a name="l00867"></a>00867       <span class="comment">//</span>
<a name="l00878"></a>00878 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1task.html#ae50f0e253e66c53e3b28e388133c8fe7" title="constructor, specify priority, name and stacksize">task</a>(
<a name="l00879"></a>00879          <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1task.html#ac5a30dff650f3b714491509cabad5dff" title="report the task priority">priority</a>  = RTOS_MAX_PRIORITY,
<a name="l00880"></a>00880          <span class="keyword">const</span> <span class="keywordtype">char</span> * tname     = <span class="stringliteral">&quot;&quot;</span>,
<a name="l00881"></a>00881          <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> stacksize = RTOS_DEFAULT_STACK_SIZE
<a name="l00882"></a>00882       );
<a name="l00883"></a>00883 
<a name="l00885"></a><a class="code" href="class_r_t_o_s_1_1task.html#a5035326ddaf51d9219a17ca6c5a23c83">00885</a>       <a class="code" href="class_r_t_o_s_1_1task.html#a5035326ddaf51d9219a17ca6c5a23c83" title="throws an error, beacuse tasks should never be destroyed">~task</a> ( <span class="keywordtype">void</span> ) {
<a name="l00886"></a>00886          mkt_fatal (#UNIQUE_ERROR); <span class="comment">// task destructor called</span>
<a name="l00887"></a>00887       }
<a name="l00888"></a>00888 
<a name="l00890"></a>00890       <span class="comment">//</span>
<a name="l00896"></a>00896 <span class="comment"></span>      <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#a80f429fbecc2cc2e8516121461df44e6" title="suspend a task (prevent execution until a resume)">suspend</a>( <span class="keywordtype">void</span> );
<a name="l00897"></a>00897       
<a name="l00899"></a>00899       <span class="comment">//</span>
<a name="l00900"></a>00900       <span class="comment">// Resumes the task (cancels a suspension).  </span>
<a name="l00904"></a>00904 <span class="comment"></span>      <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#a8f3e75810d12a7d8ac3a423cc32f4dfa" title="continue a suspended task">resume</a>( <span class="keywordtype">void</span> );
<a name="l00905"></a>00905 
<a name="l00907"></a>00907       <span class="comment">//</span>
<a name="l00910"></a>00910 <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#aa3eec7220a2724d30e2156cc395035f2" title="release the CPU to the scheduler">release</a>( <span class="keywordtype">void</span> );
<a name="l00911"></a>00911 
<a name="l00913"></a>00913       <span class="comment">//</span>
<a name="l00915"></a>00915 <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#a9d639b6f1147e0e3dbc603cdd8c52bd4" title="wait for some time">sleep</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> time );
<a name="l00916"></a>00916 
<a name="l00918"></a><a class="code" href="class_r_t_o_s_1_1task.html#ac5a30dff650f3b714491509cabad5dff">00918</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1task.html#ac5a30dff650f3b714491509cabad5dff" title="report the task priority">priority</a>( <span class="keywordtype">void</span> )<span class="keyword"> const   </span>{ <span class="keywordflow">return</span> task_priority; }
<a name="l00919"></a>00919       
<a name="l00921"></a>00921       <span class="keyword">const</span> <span class="keywordtype">char</span> * <a class="code" href="class_r_t_o_s_1_1task.html#ae41e86737164ab73a142ea8e9d3f95b4" title="report the task name">name</a>( <span class="keywordtype">void</span> ) <span class="keyword">const</span>;
<a name="l00922"></a>00922       
<a name="l00924"></a><a class="code" href="class_r_t_o_s_1_1task.html#ab02fe6432956956957bb2629dc9a3031">00924</a>       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1task.html#ab02fe6432956956957bb2629dc9a3031" title="report whether the task is currently suspended">is_suspended</a>( <span class="keywordtype">void</span> )<span class="keyword"> const       </span>{ <span class="keywordflow">return</span> task_is_suspended; }
<a name="l00925"></a>00925       
<a name="l00927"></a><a class="code" href="class_r_t_o_s_1_1task.html#a1e0b2566b673b0e4e6efd63a80284d35">00927</a>       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1task.html#a1e0b2566b673b0e4e6efd63a80284d35" title="report whether the task is currently blocked">is_blocked</a>( <span class="keywordtype">void</span> )<span class="keyword"> const         </span>{ <span class="keywordflow">return</span> task_is_blocked; }
<a name="l00928"></a>00928       
<a name="l00930"></a><a class="code" href="class_r_t_o_s_1_1task.html#a8ec666474a7668f78da3438dfa818a8e">00930</a>       <span class="keywordtype">bool</span> <a class="code" href="class_r_t_o_s_1_1task.html#a8ec666474a7668f78da3438dfa818a8e" title="report whether the task is currently ready for execution">is_ready</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{
<a name="l00931"></a>00931          <span class="keywordflow">return</span> !( task_is_suspended || task_is_blocked );
<a name="l00932"></a>00932       }
<a name="l00933"></a>00933 
<a name="l00935"></a><a class="code" href="class_r_t_o_s_1_1task.html#a76913289a89a86fcf40171e28bfcfe98">00935</a>       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#a76913289a89a86fcf40171e28bfcfe98" title="for debugging: switch logging on or off">logging_set</a>( <span class="keywordtype">bool</span> log ) { logging = log; }
<a name="l00936"></a>00936 
<a name="l00938"></a>00938       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#ac94209dd2efea030a70d48dabc890f38" title="print task statistics">print</a>( std::ostream &amp; stream, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l00939"></a>00939                   
<a name="l00941"></a>00941       <span class="comment">//</span>
<a name="l00954"></a><a class="code" href="class_r_t_o_s_1_1task.html#a6fc603d0f1c8a94813586d3dfd123fcc">00954</a> <span class="comment"></span>      <span class="keyword">event</span> <a class="code" href="class_r_t_o_s_1_1task.html#a6fc603d0f1c8a94813586d3dfd123fcc" title="wait for all waitables created for this task">wait</a>( <span class="keywordtype">void</span> ){ <span class="keywordflow">return</span> waitables.wait(); }
<a name="l00955"></a>00955       
<a name="l00957"></a>00957       <span class="comment">//</span>
<a name="l00959"></a><a class="code" href="class_r_t_o_s_1_1task.html#a7b20fada91e6d232f6791ebc9675e3fc">00959</a> <span class="comment"></span>      <span class="keyword">event</span> <a class="code" href="class_r_t_o_s_1_1task.html#a7b20fada91e6d232f6791ebc9675e3fc" title="wait for a single waitable">wait</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a> &amp; w ){ <span class="keywordflow">return</span> waitables.wait( w ); }
<a name="l00960"></a>00960       
<a name="l00962"></a>00962       <span class="comment">//</span>
<a name="l00964"></a><a class="code" href="class_r_t_o_s_1_1task.html#a09111916c62632df3042f5991ac7ab42">00964</a> <span class="comment"></span>      <span class="keyword">event</span> <a class="code" href="class_r_t_o_s_1_1task.html#a09111916c62632df3042f5991ac7ab42" title="wait for a set of waitables">wait</a>( <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">event</a> &amp; <span class="keyword">set</span> ){ <span class="keywordflow">return</span> waitables.wait( <span class="keyword">set</span> ); }
<a name="l00965"></a>00965 
<a name="l00967"></a><a class="code" href="class_r_t_o_s_1_1task.html#aebeb5ca826f7137a66474bbee3bf74a1">00967</a>       <span class="keywordtype">void</span> <span class="keyword">set</span>( <a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">flag</a> &amp;w ){ w.set(); }
<a name="l00968"></a>00968 
<a name="l00970"></a>00970       <span class="comment">//</span>
<a name="l00977"></a><a class="code" href="class_r_t_o_s_1_1task.html#a0ea383a40c40d9f69fe8e29fb36fa40d">00977</a> <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1task.html#a0ea383a40c40d9f69fe8e29fb36fa40d" title="ignore this activation for the statistics">ignore_activation_time</a>( <span class="keywordtype">void</span> ){
<a name="l00978"></a>00978          ignore_this_activation = <span class="keyword">true</span>;
<a name="l00979"></a>00979       }
<a name="l00980"></a>00980 
<a name="l00981"></a>00981    <span class="keyword">private</span>:
<a name="l00982"></a>00982 
<a name="l00984"></a>00984       <span class="keywordtype">void</span> statistics_clear( <span class="keywordtype">void</span> ){
<a name="l00985"></a>00985          runtime_max = 0;
<a name="l00986"></a>00986          activations = 0;
<a name="l00987"></a>00987       }
<a name="l00988"></a>00988 
<a name="l00990"></a>00990       waitable_set waitables;
<a name="l00991"></a>00991 
<a name="l00993"></a>00993       <span class="keywordtype">void</span> block( <span class="keywordtype">void</span> );
<a name="l00994"></a>00994 
<a name="l00996"></a>00996       <span class="keywordtype">void</span> unblock( <span class="keywordtype">void</span> );
<a name="l00997"></a>00997 
<a name="l00999"></a>00999       <span class="keywordtype">int</span> activated;
<a name="l01000"></a>01000       <span class="keywordtype">int</span> latency_max;
<a name="l01001"></a>01001       <span class="keywordtype">int</span> runtime_max;
<a name="l01002"></a>01002       <span class="keywordtype">int</span> activations;
<a name="l01003"></a>01003       <span class="keywordtype">bool</span> ignore_this_activation;
<a name="l01004"></a>01004 
<a name="l01006"></a>01006       <span class="keywordtype">bool</span> logging;
<a name="l01007"></a>01007 
<a name="l01009"></a>01009       <span class="keywordtype">void</span> debug( <span class="keyword">const</span> <span class="keywordtype">char</span> * msg );
<a name="l01010"></a>01010 
<a name="l01012"></a>01012       task * nextTask;
<a name="l01013"></a>01013 
<a name="l01015"></a>01015       task * next_mutex_waiter;
<a name="l01016"></a>01016 
<a name="l01018"></a>01018       mkt_coroutine_class *coroutine;
<a name="l01019"></a>01019 
<a name="l01020"></a>01020       <span class="keyword">friend</span> <span class="keyword">class </span>periodic_task;
<a name="l01021"></a>01021       <span class="keyword">friend</span> <span class="keyword">class </span>waitable_set;
<a name="l01022"></a>01022       <span class="keyword">friend</span> <span class="keyword">class </span>flag;
<a name="l01023"></a>01023       <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01024"></a>01024    };
<a name="l01025"></a>01025 
<a name="l01026"></a>01026 
<a name="l01027"></a>01027    <span class="comment">//************************************************************************</span>
<a name="l01028"></a>01028    <span class="comment">//</span>
<a name="l01029"></a>01029    <span class="comment">// class callback</span>
<a name="l01030"></a>01030    <span class="comment">//</span>
<a name="l01032"></a>01032 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01033"></a>01033    <span class="comment">//************************************************************************</span>
<a name="l01034"></a>01034 
<a name="l01035"></a>01035 <span class="keyword">private</span>:
<a name="l01036"></a>01036    <span class="keyword">class </span>callback {
<a name="l01037"></a>01037    <span class="keyword">public</span>:
<a name="l01038"></a>01038 
<a name="l01039"></a>01039       callback( <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> );
<a name="l01040"></a>01040 
<a name="l01041"></a>01041       <span class="comment">// a timer should never be destroyed</span>
<a name="l01042"></a>01042       ~callback( <span class="keywordtype">void</span> ) {
<a name="l01043"></a>01043          mkt_fatal (#UNIQUE_ERROR); <span class="comment">// callback_timer destructor called</span>
<a name="l01044"></a>01044       }
<a name="l01045"></a>01045 
<a name="l01046"></a>01046       <span class="comment">// a timer&#39;s time_up function must be provided by a derived class</span>
<a name="l01047"></a>01047       <span class="keyword">virtual</span> <span class="keywordtype">void</span> time_up (<span class="keywordtype">void</span>) = 0;
<a name="l01048"></a>01048 
<a name="l01049"></a>01049    <span class="keyword">protected</span>:
<a name="l01050"></a>01050       <span class="comment">// the callback must fire &lt;time&gt; from now</span>
<a name="l01051"></a>01051       <span class="keywordtype">void</span> start( <span class="keywordtype">long</span> <span class="keywordtype">int</span> time ){ time_to_wait = time; }
<a name="l01052"></a>01052 
<a name="l01053"></a>01053       <span class="comment">// the callback must fire &lt;time&gt; from the last firing</span>
<a name="l01054"></a>01054       <span class="keywordtype">void</span> restart( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> time ){
<a name="l01055"></a>01055          <span class="keywordflow">while</span>( time_to_wait &lt;= 0 ){ time_to_wait += time; }
<a name="l01056"></a>01056       }
<a name="l01057"></a>01057 
<a name="l01058"></a>01058       <span class="comment">// abort a started timer</span>
<a name="l01059"></a>01059       <span class="keyword">virtual</span> <span class="keywordtype">void</span> cancel( <span class="keywordtype">void</span> ){ time_to_wait = 0; }
<a name="l01060"></a>01060 
<a name="l01061"></a>01061       RTOS_STATISTICS( <span class="keyword">const</span> <span class="keywordtype">char</span> * object_name; )
<a name="l01062"></a>01062 
<a name="l01063"></a>01063          <span class="comment">// the number of microseconds until the next time_up</span>
<a name="l01064"></a>01064       <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> time_to_wait;
<a name="l01065"></a>01065 
<a name="l01066"></a>01066          <span class="comment">// called by the RTOS to state that &lt;elapsed&gt; time has elapsed</span>
<a name="l01067"></a>01067       <span class="keywordtype">void</span> tick( <span class="keywordtype">int</span> elapsed );
<a name="l01068"></a>01068 
<a name="l01069"></a>01069          <span class="comment">// for the RTOS to link timers in a chain</span>
<a name="l01070"></a>01070       callback * nextTimer;
<a name="l01071"></a>01071 
<a name="l01072"></a>01072       <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01073"></a>01073    };
<a name="l01074"></a>01074 
<a name="l01075"></a>01075 
<a name="l01076"></a>01076    <span class="comment">//************************************************************************</span>
<a name="l01077"></a>01077    <span class="comment">//</span>
<a name="l01078"></a>01078    <span class="comment">// class timer</span>
<a name="l01079"></a>01079    <span class="comment">//</span>
<a name="l01081"></a>01081 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01104"></a>01104 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01105"></a>01105    <span class="comment">//************************************************************************</span>
<a name="l01106"></a>01106 
<a name="l01107"></a>01107 <span class="keyword">public</span>:
<a name="l01108"></a><a class="code" href="class_r_t_o_s_1_1timer.html">01108</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a>, <span class="keyword">public</span> callback {
<a name="l01109"></a>01109    <span class="keyword">public</span>:
<a name="l01110"></a>01110       
<a name="l01112"></a>01112       <a class="code" href="class_r_t_o_s_1_1timer.html#a5a2a759e35dd9d7cea8971db60fbe741" title="create a timer for task t, specify its name">timer</a>( task * t, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> );
<a name="l01113"></a>01113       
<a name="l01115"></a>01115       <span class="comment">//</span>
<a name="l01120"></a>01120 <span class="comment"></span>      <span class="keywordtype">void</span> <span class="keyword">set</span>( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> time );
<a name="l01121"></a>01121       
<a name="l01123"></a>01123       <span class="comment">//</span>
<a name="l01126"></a>01126 <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1timer.html#a6df8dddc38d933432131efba05168d10" title="stop and clear the timer">cancel</a>( <span class="keywordtype">void</span> );
<a name="l01127"></a>01127 
<a name="l01129"></a>01129       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1timer.html#aca6725d409de3630e4b8b7883dacbc4f" title="print the timer (for debugging)">print</a>( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01130"></a>01130 
<a name="l01131"></a>01131    <span class="keyword">private</span>:
<a name="l01132"></a>01132       <span class="keywordtype">void</span> time_up( <span class="keywordtype">void</span> ){ <a class="code" href="class_r_t_o_s_1_1waitable.html#a3a72bdf94092471e82ba2d04cdc4a58e" title="set the waitable">waitable::set</a>(); }
<a name="l01133"></a>01133       RTOS_STATISTICS( <a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">timer</a> *next_timer; )
<a name="l01134"></a>01134       RTOS_STATISTICS( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n_sets; )
<a name="l01135"></a>01135       RTOS_STATISTICS( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> n_cancels; )
<a name="l01136"></a>01136       <span class="keyword">friend</span> <span class="keyword">class</span> <a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01137"></a>01137    };
<a name="l01138"></a>01138 
<a name="l01139"></a>01139    <span class="comment">//************************************************************************</span>
<a name="l01140"></a>01140    <span class="comment">//</span>
<a name="l01141"></a>01141    <span class="comment">// class clock</span>
<a name="l01142"></a>01142    <span class="comment">//</span>
<a name="l01144"></a>01144 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01161"></a>01161 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01162"></a>01162    <span class="comment">//************************************************************************</span>
<a name="l01163"></a>01163 
<a name="l01164"></a>01164 <span class="keyword">public</span>:
<a name="l01165"></a><a class="code" href="class_r_t_o_s_1_1clock.html">01165</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">clock</a> :  <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a>, <span class="keyword">public</span> callback {
<a name="l01166"></a>01166    <span class="keyword">public</span>:
<a name="l01167"></a>01167       
<a name="l01169"></a>01169         <span class="comment">//</span>
<a name="l01171"></a>01171 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1clock.html#acddd4420f67c5af6e130ca177526d148" title="create a clock for task t, specify interval and name">clock</a>( 
<a name="l01172"></a>01172          task * t, 
<a name="l01173"></a>01173          <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1clock.html#aeef3e995e7334fc203f0062e532a5804" title="the interval of the timer">interval</a>, 
<a name="l01174"></a>01174          <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> 
<a name="l01175"></a>01175       );
<a name="l01176"></a>01176       
<a name="l01178"></a>01178       <span class="comment">//</span>
<a name="l01180"></a><a class="code" href="class_r_t_o_s_1_1clock.html#a90d7c2b274fff1b43a1de08e742c41c3">01180</a> <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1clock.html#a90d7c2b274fff1b43a1de08e742c41c3" title="clear the waitable within the clock">clear</a>( <span class="keywordtype">void</span> ){ <a class="code" href="class_r_t_o_s_1_1clock.html#a90d7c2b274fff1b43a1de08e742c41c3" title="clear the waitable within the clock">waitable::clear</a>(); }
<a name="l01181"></a>01181          
<a name="l01183"></a><a class="code" href="class_r_t_o_s_1_1clock.html#aeef3e995e7334fc203f0062e532a5804">01183</a>       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_r_t_o_s_1_1clock.html#aeef3e995e7334fc203f0062e532a5804" title="the interval of the timer">interval</a>( <span class="keywordtype">void</span> ){ <span class="keywordflow">return</span> _interval; }
<a name="l01184"></a>01184 
<a name="l01186"></a>01186       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1clock.html#ad2d6da1595d84cbcc93cb73ed888a72a" title="print the clock (for debugging)">print</a>( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01187"></a>01187 
<a name="l01188"></a>01188    <span class="keyword">private</span>:
<a name="l01189"></a>01189       <span class="keywordtype">void</span> time_up( <span class="keywordtype">void</span> );
<a name="l01190"></a>01190       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> _interval;
<a name="l01191"></a>01191       RTOS_STATISTICS( <a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">clock</a> *next_clock; )
<a name="l01192"></a>01192       RTOS_STATISTICS( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> ticks; )
<a name="l01193"></a>01193 
<a name="l01194"></a>01194       <span class="keyword">friend</span> <span class="keyword">class</span> <a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01195"></a>01195    };
<a name="l01196"></a>01196 
<a name="l01197"></a>01197 
<a name="l01198"></a>01198    <span class="comment">//************************************************************************</span>
<a name="l01199"></a>01199    <span class="comment">//</span>
<a name="l01200"></a>01200    <span class="comment">// class pool_base</span>
<a name="l01201"></a>01201    <span class="comment">//</span>
<a name="l01203"></a>01203 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01204"></a>01204    <span class="comment">//************************************************************************</span>
<a name="l01205"></a>01205 
<a name="l01206"></a>01206 <span class="keyword">public</span>:
<a name="l01207"></a><a class="code" href="class_r_t_o_s_1_1pool__base.html">01207</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a> {
<a name="l01208"></a>01208    <span class="keyword">public</span>:
<a name="l01209"></a>01209       <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> * name );
<a name="l01210"></a>01210       ~<a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a>( <span class="keywordtype">void</span> ) {
<a name="l01211"></a>01211          mkt_fatal (#UNIQUE_ERROR); <span class="comment">// pool destructor called</span>
<a name="l01212"></a>01212       }
<a name="l01213"></a>01213       <span class="keywordtype">void</span> print( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01214"></a>01214 
<a name="l01215"></a>01215 <span class="preprocessor">   #if RTOS_STATISTICS_ENABLED</span>
<a name="l01216"></a>01216 <span class="preprocessor"></span>      <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> reads;
<a name="l01217"></a>01217       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> writes;
<a name="l01218"></a>01218       <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a> * next_pool;
<a name="l01219"></a>01219       <span class="keyword">const</span> <span class="keywordtype">char</span> * pool_name;
<a name="l01220"></a>01220 <span class="preprocessor">   #endif</span>
<a name="l01221"></a>01221 <span class="preprocessor"></span>      <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01222"></a>01222    };
<a name="l01223"></a>01223 
<a name="l01224"></a>01224    <span class="comment">//************************************************************************</span>
<a name="l01225"></a>01225    <span class="comment">//</span>
<a name="l01226"></a>01226    <span class="comment">// class pool</span>
<a name="l01227"></a>01227    <span class="comment">//</span>
<a name="l01229"></a>01229 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01268"></a>01268 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01269"></a>01269    <span class="comment">//************************************************************************</span>
<a name="l01270"></a>01270 
<a name="l01271"></a>01271 <span class="keyword">public</span>:
<a name="l01272"></a><a class="code" href="class_r_t_o_s_1_1pool.html">01272</a>    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1pool.html" title="place to store and rectrieve data, no built-in synchronisation">pool</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a> {
<a name="l01273"></a>01273    <span class="keyword">public</span>:
<a name="l01274"></a>01274       
<a name="l01276"></a>01276         <span class="comment">//</span>
<a name="l01282"></a><a class="code" href="class_r_t_o_s_1_1pool.html#a34dfd08a46f1fd274f1692469eebaf36">01282</a> <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1pool.html#a34dfd08a46f1fd274f1692469eebaf36" title="construct a pool, specify its name (for debgging only)">pool</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> ): <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">pool_base</a>( name ){}
<a name="l01283"></a>01283 
<a name="l01285"></a>01285       <span class="comment">//</span>
<a name="l01293"></a><a class="code" href="class_r_t_o_s_1_1pool.html#a2bd2a2bfb99d74c8b123de344698ff53">01293</a> <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1pool.html#a2bd2a2bfb99d74c8b123de344698ff53" title="atomic write operation on a pool">write</a> (T item) {
<a name="l01294"></a>01294          RTOS_STATISTICS( reads++; )
<a name="l01295"></a>01295          data = item;
<a name="l01296"></a>01296       }
<a name="l01297"></a>01297 
<a name="l01299"></a>01299       <span class="comment">//</span>
<a name="l01301"></a><a class="code" href="class_r_t_o_s_1_1pool.html#a0ef6382b71ae141cf38f477c8bfea325">01301</a> <span class="comment"></span>      T <a class="code" href="class_r_t_o_s_1_1pool.html#a0ef6382b71ae141cf38f477c8bfea325" title="atomic read operation on a pool">read</a> (<span class="keywordtype">void</span>) {
<a name="l01302"></a>01302          RTOS_STATISTICS( writes++; )
<a name="l01303"></a>01303          <span class="keywordflow">return</span> data;
<a name="l01304"></a>01304       }
<a name="l01305"></a>01305 
<a name="l01306"></a>01306    <span class="keyword">private</span>:
<a name="l01307"></a>01307       T data;
<a name="l01308"></a>01308    };
<a name="l01309"></a>01309 
<a name="l01310"></a>01310 
<a name="l01311"></a>01311    <span class="comment">//************************************************************************</span>
<a name="l01312"></a>01312    <span class="comment">//</span>
<a name="l01313"></a>01313    <span class="comment">// class mutex</span>
<a name="l01314"></a>01314    <span class="comment">//</span>
<a name="l01316"></a>01316 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01345"></a>01345 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01346"></a>01346    <span class="comment">//************************************************************************</span>
<a name="l01347"></a>01347 
<a name="l01348"></a>01348 <span class="keyword">public</span>:
<a name="l01349"></a><a class="code" href="class_r_t_o_s_1_1mutex.html">01349</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">mutex</a> {
<a name="l01350"></a>01350    <span class="keyword">public</span>:
<a name="l01351"></a>01351       
<a name="l01353"></a>01353         <span class="comment">//</span>
<a name="l01355"></a>01355 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1mutex.html#a018aed6b83cf182b9990ac90a3254904" title="constructor, specify the name">mutex</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> );
<a name="l01356"></a>01356       
<a name="l01358"></a>01358       <span class="comment">//</span>
<a name="l01360"></a>01360 <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1mutex.html#a58255b4d832c8140f2b45efcc2065733" title="generates an error">~mutex</a>( <span class="keywordtype">void</span> );  
<a name="l01361"></a>01361       
<a name="l01363"></a>01363       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1mutex.html#aef6201cdf6b86c532629b5888d740303" title="prints a mutex, for debugging only.">print</a>( std::ostream &amp; stream, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01364"></a>01364 
<a name="l01374"></a>01374       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1mutex.html#a52160d98a50d74a44fc4592a4625c6ed">wait</a>   (<span class="keywordtype">void</span>);
<a name="l01375"></a>01375       
<a name="l01377"></a>01377       <span class="comment">//</span>
<a name="l01385"></a>01385 <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1mutex.html#a9a6cb88e182f977bce35e024449b24cd" title="release the mutex">signal</a> (<span class="keywordtype">void</span>);
<a name="l01386"></a>01386 
<a name="l01387"></a>01387    <span class="keyword">private</span>:
<a name="l01388"></a>01388       task * owner;             <span class="comment">// current owner of the mutex</span>
<a name="l01389"></a>01389       task * waiters;           <span class="comment">// head of the waiting tasks queue</span>
<a name="l01390"></a>01390 <span class="preprocessor">   #if RTOS_STATISTICS_ENABLED</span>
<a name="l01391"></a>01391 <span class="preprocessor"></span>      <span class="keyword">const</span> <span class="keywordtype">char</span> * mutex_name;  <span class="comment">// for logging</span>
<a name="l01392"></a>01392       <a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">mutex</a> *next_mutex;        <span class="comment">// queue of all mutexes, for logging</span>
<a name="l01393"></a>01393       <span class="keywordtype">int</span> wait_count;           <span class="comment">// counts # wait calls;</span>
<a name="l01394"></a>01394 <span class="preprocessor">   #endif</span>
<a name="l01395"></a>01395 <span class="preprocessor"></span>      <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01396"></a>01396    };
<a name="l01397"></a>01397 
<a name="l01398"></a>01398 
<a name="l01399"></a>01399    <span class="comment">//************************************************************************</span>
<a name="l01400"></a>01400    <span class="comment">//</span>
<a name="l01401"></a>01401    <span class="comment">// class mailbox_base</span>
<a name="l01402"></a>01402    <span class="comment">//</span>
<a name="l01404"></a>01404 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01405"></a>01405    <span class="comment">//************************************************************************</span>
<a name="l01406"></a>01406 
<a name="l01407"></a>01407 <span class="keyword">public</span>:
<a name="l01408"></a><a class="code" href="class_r_t_o_s_1_1mailbox__base.html">01408</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a> {
<a name="l01409"></a>01409    <span class="keyword">public</span>:
<a name="l01410"></a>01410       <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *name );
<a name="l01411"></a>01411 
<a name="l01412"></a>01412       ~<a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a>( <span class="keywordtype">void</span> ) {
<a name="l01413"></a>01413          mkt_fatal (#UNIQUE_ERROR); <span class="comment">// mailbox destructor called</span>
<a name="l01414"></a>01414       }
<a name="l01415"></a>01415 
<a name="l01416"></a>01416       <span class="keywordtype">void</span> print( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01417"></a>01417 
<a name="l01418"></a>01418       task * client;
<a name="l01419"></a>01419 <span class="preprocessor">   #if RTOS_STATISTICS_ENABLED</span>
<a name="l01420"></a>01420 <span class="preprocessor"></span>      <span class="keyword">const</span> <span class="keywordtype">char</span> * mailbox_name;
<a name="l01421"></a>01421       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> writes;
<a name="l01422"></a>01422       <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a> *next_mailbox;
<a name="l01423"></a>01423 <span class="preprocessor">   #endif</span>
<a name="l01424"></a>01424 <span class="preprocessor"></span>   
<a name="l01425"></a>01425    };
<a name="l01426"></a>01426 
<a name="l01427"></a>01427    <span class="comment">//************************************************************************</span>
<a name="l01428"></a>01428    <span class="comment">//</span>
<a name="l01429"></a>01429    <span class="comment">//</span>
<a name="l01430"></a>01430    <span class="comment">// class mailbox</span>
<a name="l01431"></a>01431    <span class="comment">//</span>
<a name="l01433"></a>01433 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01459"></a>01459 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01460"></a>01460    <span class="comment">//************************************************************************</span>
<a name="l01461"></a>01461 
<a name="l01462"></a>01462 <span class="keyword">public</span>:
<a name="l01463"></a><a class="code" href="class_r_t_o_s_1_1mailbox.html">01463</a>    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1mailbox.html" title="synchronous handling over of a data item">mailbox</a> : <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a> {
<a name="l01464"></a>01464    <span class="keyword">public</span>:
<a name="l01465"></a>01465       
<a name="l01467"></a>01467         <span class="comment">//</span>
<a name="l01469"></a>01469 <span class="comment"></span>        <span class="comment">// The name is used for debugging and statistics.</span>
<a name="l01473"></a><a class="code" href="class_r_t_o_s_1_1mailbox.html#aaee470ef9fc6627e848e45ca353415ff">01473</a> <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1mailbox.html#aaee470ef9fc6627e848e45ca353415ff" title="construtor, specify mutex name">mailbox</a>( <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span>  ): <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">mailbox_base</a>( name ){}
<a name="l01474"></a>01474 
<a name="l01476"></a>01476       <span class="comment">//</span>
<a name="l01484"></a><a class="code" href="class_r_t_o_s_1_1mailbox.html#ad140965320e8b42ca16a5d288858f70d">01484</a> <span class="comment"></span>      <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1mailbox.html#ad140965320e8b42ca16a5d288858f70d" title="write an item into the mailbox">write</a>( <span class="keyword">const</span> T item ) {
<a name="l01485"></a>01485          RTOS_STATISTICS( writes++; )
<a name="l01486"></a>01486          data = item;
<a name="l01487"></a>01487          <span class="keywordflow">if</span> ( client != NULL ) {
<a name="l01488"></a>01488             <span class="comment">// someone is waiting to read, unblock it</span>
<a name="l01489"></a>01489             client-&gt;unblock();
<a name="l01490"></a>01490             } <span class="keywordflow">else</span> {
<a name="l01491"></a>01491                 <span class="comment">// block until the reader gets the data</span>
<a name="l01492"></a>01492                 client = <a class="code" href="class_r_t_o_s.html#a7e455e2e010e6af8f9f41cbeacfe6bd0" title="returns (a pointer to) the currently executing task">RTOS::current_task</a>();
<a name="l01493"></a>01493              client-&gt;block();
<a name="l01494"></a>01494             }
<a name="l01495"></a>01495       }
<a name="l01496"></a>01496       
<a name="l01498"></a>01498       <span class="comment">//</span>
<a name="l01506"></a><a class="code" href="class_r_t_o_s_1_1mailbox.html#af2bc862b64929b5ec34afa4dec0ed720">01506</a> <span class="comment"></span>      T <a class="code" href="class_r_t_o_s_1_1mailbox.html#af2bc862b64929b5ec34afa4dec0ed720" title="read a value from the mailbox">read</a> (<span class="keywordtype">void</span>) {
<a name="l01507"></a>01507          <span class="keywordflow">if</span> ( client == NULL ) {
<a name="l01508"></a>01508             <span class="comment">// no writer yet, so wait for a writer</span>
<a name="l01509"></a>01509             client = <a class="code" href="class_r_t_o_s.html#a7e455e2e010e6af8f9f41cbeacfe6bd0" title="returns (a pointer to) the currently executing task">RTOS::current_task</a>();
<a name="l01510"></a>01510             client-&gt;block();
<a name="l01511"></a>01511          }
<a name="l01512"></a>01512          <span class="keywordflow">else</span> {
<a name="l01513"></a>01513             <span class="comment">// unblock the writer</span>
<a name="l01514"></a>01514             client-&gt;unblock();
<a name="l01515"></a>01515               client = NULL;
<a name="l01516"></a>01516          }
<a name="l01517"></a>01517            <span class="keywordflow">return</span> data;
<a name="l01518"></a>01518       }
<a name="l01519"></a>01519 
<a name="l01520"></a>01520    <span class="keyword">private</span>:
<a name="l01521"></a>01521       T data;
<a name="l01522"></a>01522    };
<a name="l01523"></a>01523 
<a name="l01524"></a>01524    <span class="comment">//************************************************************************</span>
<a name="l01525"></a>01525    <span class="comment">//</span>
<a name="l01526"></a>01526    <span class="comment">// class channel_base</span>
<a name="l01527"></a>01527    <span class="comment">//</span>
<a name="l01529"></a>01529 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01530"></a>01530    <span class="comment">//************************************************************************</span>
<a name="l01531"></a>01531 
<a name="l01532"></a>01532 <span class="keyword">public</span>:
<a name="l01533"></a><a class="code" href="class_r_t_o_s_1_1channel__base.html">01533</a>    <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1waitable.html" title="abstract thing that a task can wait for">waitable</a>{
<a name="l01534"></a>01534    <span class="keyword">public</span>:
<a name="l01535"></a>01535       ~<a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a>( <span class="keywordtype">void</span> ) {
<a name="l01536"></a>01536          mkt_fatal (#UNIQUE_ERROR); <span class="comment">// channel destructor called</span>
<a name="l01537"></a>01537       }
<a name="l01538"></a>01538 
<a name="l01539"></a>01539       <span class="keywordtype">void</span> print( std::ostream &amp; s, <span class="keywordtype">bool</span> header = <span class="keyword">true</span> ) <span class="keyword">const</span>;
<a name="l01540"></a>01540 
<a name="l01541"></a>01541    <span class="keyword">protected</span>:
<a name="l01542"></a>01542       <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a>( task * t, <span class="keyword">const</span> <span class="keywordtype">char</span> *name );
<a name="l01543"></a>01543 
<a name="l01544"></a>01544 <span class="preprocessor">   #if RTOS_STATISTICS_ENABLED</span>
<a name="l01545"></a>01545 <span class="preprocessor"></span>      <span class="keyword">const</span> <span class="keywordtype">char</span> *channel_name;
<a name="l01546"></a>01546       <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a> *next_channel;
<a name="l01547"></a>01547       <span class="keywordtype">int</span> writes;
<a name="l01548"></a>01548       <span class="keywordtype">int</span> ignores;
<a name="l01549"></a>01549 <span class="preprocessor">   #endif</span>
<a name="l01550"></a>01550 <span class="preprocessor"></span>      <span class="keywordtype">int</span> qSize;
<a name="l01551"></a>01551       <span class="keywordtype">int</span> head;
<a name="l01552"></a>01552       <span class="keywordtype">int</span> tail;
<a name="l01553"></a>01553       <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="class_r_t_o_s.html" title="static class, namespace-like container for RTOS declarations">RTOS</a>;
<a name="l01554"></a>01554    };
<a name="l01555"></a>01555 
<a name="l01556"></a>01556    <span class="comment">//************************************************************************</span>
<a name="l01557"></a>01557    <span class="comment">//</span>
<a name="l01558"></a>01558    <span class="comment">// class channel</span>
<a name="l01559"></a>01559    <span class="comment">//</span>
<a name="l01561"></a>01561 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01615"></a>01615 <span class="comment"></span>   <span class="comment">//</span>
<a name="l01616"></a>01616    <span class="comment">//************************************************************************</span>
<a name="l01617"></a>01617 
<a name="l01618"></a>01618 <span class="keyword">public</span>:
<a name="l01619"></a><a class="code" href="class_r_t_o_s_1_1channel.html">01619</a>    <span class="keyword">template</span> &lt;<span class="keyword">class</span> T, const <span class="keywordtype">int</span> SIZE&gt; <span class="keyword">class </span><a class="code" href="class_r_t_o_s_1_1channel.html" title="waitable data queue">channel</a> : <span class="keyword">public</span> <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a> {
<a name="l01620"></a>01620    <span class="keyword">public</span>:
<a name="l01621"></a>01621 
<a name="l01623"></a>01623       <span class="comment">//</span>
<a name="l01626"></a><a class="code" href="class_r_t_o_s_1_1channel.html#a5580e7cd248a64985c8866c528cfebe6">01626</a> <span class="comment"></span>      <a class="code" href="class_r_t_o_s_1_1channel.html#a5580e7cd248a64985c8866c528cfebe6" title="constructor, specify stored type, number of entries, and name">channel</a>( task * t, <span class="keyword">const</span> <span class="keywordtype">char</span> *name = <span class="stringliteral">&quot;&quot;</span> ): <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">channel_base</a>( t, name ){}
<a name="l01627"></a>01627 
<a name="l01629"></a><a class="code" href="class_r_t_o_s_1_1channel.html#a09e4d10e0336283eb9ae402df0a25dbc">01629</a>       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1channel.html#a09e4d10e0336283eb9ae402df0a25dbc" title="write an item to the queue">write</a>( T item ) {
<a name="l01630"></a>01630          <span class="keywordflow">if</span>( qSize &lt; SIZE ) {
<a name="l01631"></a>01631             RTOS_STATISTICS( writes++; )
<a name="l01632"></a>01632             queue[head] = item;
<a name="l01633"></a>01633             <span class="keywordflow">if</span>( ++head == SIZE ) {
<a name="l01634"></a>01634                head = 0;
<a name="l01635"></a>01635             }
<a name="l01636"></a>01636             qSize += 1;
<a name="l01637"></a>01637             <a class="code" href="class_r_t_o_s_1_1waitable.html#a3a72bdf94092471e82ba2d04cdc4a58e" title="set the waitable">waitable::set</a>();
<a name="l01638"></a>01638          } <span class="keywordflow">else</span> {
<a name="l01639"></a>01639             RTOS_STATISTICS( ignores++; )
<a name="l01640"></a>01640          }
<a name="l01641"></a>01641       }
<a name="l01642"></a>01642 
<a name="l01644"></a><a class="code" href="class_r_t_o_s_1_1channel.html#a66da852f3e9ef72066e5f582f4c2f218">01644</a>       T <a class="code" href="class_r_t_o_s_1_1channel.html#a66da852f3e9ef72066e5f582f4c2f218" title="read an item from the queue">read</a>( <span class="keywordtype">void</span> ) {
<a name="l01645"></a>01645          <span class="keywordflow">if</span>( qSize == 0 ) {
<a name="l01646"></a>01646             t-&gt;<a class="code" href="class_r_t_o_s_1_1task.html#a6fc603d0f1c8a94813586d3dfd123fcc" title="wait for all waitables created for this task">wait</a>( *<span class="keyword">this</span> );
<a name="l01647"></a>01647          }
<a name="l01648"></a>01648 
<a name="l01649"></a>01649          <span class="keywordflow">if</span>( qSize == 0 ) {
<a name="l01650"></a>01650             mkt_fatal (#UNIQUE_ERROR); <span class="comment">// channel should not be empty now</span>
<a name="l01651"></a>01651          }
<a name="l01652"></a>01652          T buf = queue[ tail ];
<a name="l01653"></a>01653          <span class="keywordflow">if</span>( ++tail == SIZE ) {
<a name="l01654"></a>01654             tail = 0;
<a name="l01655"></a>01655          }
<a name="l01656"></a>01656          qSize -= 1;
<a name="l01657"></a>01657          <span class="keywordflow">if</span>( qSize &gt; 0 ) {
<a name="l01658"></a>01658             <a class="code" href="class_r_t_o_s_1_1waitable.html#a3a72bdf94092471e82ba2d04cdc4a58e" title="set the waitable">waitable::set</a>();
<a name="l01659"></a>01659          } <span class="keywordflow">else</span> {
<a name="l01660"></a>01660             <a class="code" href="class_r_t_o_s_1_1channel.html#afd8cd81a91225ed144fc1ca20f3cd8f6" title="clear the waitable">waitable::clear</a>();
<a name="l01661"></a>01661          }
<a name="l01662"></a>01662          <span class="keywordflow">return</span> buf;
<a name="l01663"></a>01663       }
<a name="l01664"></a>01664 
<a name="l01665"></a><a class="code" href="class_r_t_o_s_1_1channel.html#afd8cd81a91225ed144fc1ca20f3cd8f6">01665</a>       <span class="keywordtype">void</span> <a class="code" href="class_r_t_o_s_1_1channel.html#afd8cd81a91225ed144fc1ca20f3cd8f6" title="clear the waitable">clear</a> (<span class="keywordtype">void</span>) {
<a name="l01666"></a>01666          qSize = 0;
<a name="l01667"></a>01667          head = tail = 0;
<a name="l01668"></a>01668          <a class="code" href="class_r_t_o_s_1_1channel.html#afd8cd81a91225ed144fc1ca20f3cd8f6" title="clear the waitable">waitable::clear</a>();
<a name="l01669"></a>01669       }
<a name="l01670"></a>01670    <span class="keyword">private</span>:
<a name="l01671"></a>01671       T queue[ SIZE] ;
<a name="l01672"></a>01672    };
<a name="l01673"></a>01673 
<a name="l01674"></a>01674 };
<a name="l01675"></a>01675 
<a name="l01676"></a>01676 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1task.html" title="an independent thread of execution">RTOS::task</a> &amp; t );
<a name="l01677"></a>01677 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1flag.html" title="basic synchronisation mechanism.">RTOS::flag</a> &amp; f );
<a name="l01678"></a>01678 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1event.html" title="set of things that can happen, or a thing that has happened">RTOS::event</a> &amp; e );
<a name="l01679"></a>01679 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1timer.html" title="one-short timer">RTOS::timer</a> &amp; t );
<a name="l01680"></a>01680 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1clock.html" title="free-running clock, ticks at a fixed frequency">RTOS::clock</a> &amp; c );
<a name="l01681"></a>01681 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1channel__base.html" title="RTOS private implementation class.">RTOS::channel_base</a> &amp; c );
<a name="l01682"></a>01682 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1mutex.html" title="mutual execlusion semaphore">RTOS::mutex</a> &amp; m );
<a name="l01683"></a>01683 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1mailbox__base.html" title="RTOS private implementation class.">RTOS::mailbox_base</a> &amp; m );
<a name="l01684"></a>01684 std::ostream &amp; operator&lt;&lt; ( std::ostream &amp; s, <span class="keyword">const</span> <a class="code" href="class_r_t_o_s_1_1pool__base.html" title="RTOS private implementation class.">RTOS::pool_base</a> &amp; p );
<a name="l01685"></a>01685 
<a name="l01686"></a>01686 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>



<hr class="footer"/><address class="footer"><small>
Generated on Sat Apr 14 2012 15:59:23 for RTOS - a cooperative multitasking library by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.5.1
</small></address>

</body>
</html>
